home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 2000
/
MacHack 2000.toast
/
pc
/
The Hacks
/
Softshoe
/
Lisa's Mac Parts
/
Views
/
Canvas Loops
/
FirstCanvas.h
< prev
next >
Wrap
Text File
|
2000-06-23
|
886b
|
44 lines
// FirstCanvas.h
#ifndef FirstCanvas_h
#define FirstCanvas_h
#ifndef ValidCanvasLoop_h
#include "ValidCanvasLoop.h"
#endif
/*
This is an adapter for code like TextEdit
or the Control Manager that doesn't expect
multiple canvases.
On construction, It sets up the first valid
canvas for the view, or if there is none, a canvas
in the NoPort.
On destruction, it invalidates all remaining canvases
of the view -- thus inefficiently causing the results
of any operation performed in between to be echoed.
*/
class FirstCanvas
{
private:
ValidCanvasLoop validCanvas;
FirstCanvas( const FirstCanvas& );
void operator=( const FirstCanvas& );
public:
FirstCanvas( const DrawsSpontaneously& view )
: validCanvas( view )
{}
~FirstCanvas();
const Canvas& operator*() const;
const Canvas *operator->() const { return &operator*(); }
};
#endif